//
//  StatusForwordCell.swift
//  SinaWeiBo
//
//  Created by gxiangzi on 15/9/9.
//  Copyright © 2015年 hqu. All rights reserved.
//

import UIKit

class StatusForwordCell: StatusCell {

    override var statusViewModel: StatusViewModel? {
        didSet {
            
            forwardLabel.text = statusViewModel?.forwardText
        }
    }
    
    // 设置UI
    override func setupUI() {
        // 执行父类的方法
        super.setupUI()
        
        // 1.添加控件
        contentView.insertSubview(backButton, belowSubview: pictureView)
        contentView.insertSubview(forwardLabel, aboveSubview: backButton)
        
        
        // 2.设置布局
        backButton.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: contentLabel, size: nil, offset: CGPoint(x: -GXStatusCellMargin, y:GXStatusCellMargin))
        backButton.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bottonView, size: nil)
        
        forwardLabel.ff_AlignInner(type: ff_AlignType.TopLeft, referView: backButton, size: nil, offset: CGPoint(x: GXStatusCellMargin, y: GXStatusCellMargin))
        
        
        let cons =  pictureView.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: forwardLabel, size: CGSize(width: GXStatusPictureMaxWidth, height: GXStatusPictureMaxWidth), offset: CGPoint(x: 0, y: GXStatusCellMargin))
        pictureViewWidthCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Width)
        pictureViewHeightCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Height)
        pictureViewTopCosn = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Top)
        
    }
    
    private lazy var backButton : UIButton = {
    
        let button = UIButton()
        
        button.backgroundColor = UIColor.grayColor()
        return button
    }()
    
    /// 转发的文字
    private lazy var forwardLabel:UILabel = UILabel(title: "转发微博", color: UIColor.darkGrayColor(), fontSize: 14, layoutWidth: UIScreen.mainScreen().bounds.width - 2 * GXStatusCellMargin)
}
